package com.c4p.im.session;

import io.netty.channel.Channel;

import java.util.concurrent.ConcurrentHashMap;

public class MemoryUserChannelStore implements IUserChannelStore {

    private static ConcurrentHashMap<String, Channel> USER_TOKEN_CHANNEL = new ConcurrentHashMap<>();

    @Override
    public void put(String userId, Channel channel) {
        USER_TOKEN_CHANNEL.put(userId, channel);
    }

    @Override
    public Channel get(String userId) {
        return USER_TOKEN_CHANNEL.get(userId);
    }

    public void remove(String userId) {
        USER_TOKEN_CHANNEL.remove(userId);
    }
}
